#include <iostream>
#include <cstdio>
#include <algorithm>
#include <map>
#include <cstring>
#include <vector>
#include<queue>
using namespace std;
#define ll long long 
#define MAXL 100005
#define mod 998244353
unsigned short a[MAXL];
struct ji
{
	int ak[101];
} d[MAXL];
int main()
{
	int n, m, q;
	cin >> n >> m >> q;
	for (int i = 1; i <= n; i++)
	{
		cin >> a[i];
	}
	for (int i = 1; i <= n; i++)
	{
		d[i].ak[a[i]]++;
		for (int j = 1; j <= m; j++)
		{
			d[i].ak[j] += d[i - 1].ak[j];
		}
	}
	while (q--)
	{
		int l, r,mmx=0,mm;
		cin >> l >> r;
		for (int i = 1; i <= m; i++)
		{
			if (d[r].ak[i] - d[l - 1].ak[i] > mmx)
			{
				mmx = d[r].ak[i] - d[l - 1].ak[i];
				mm = i;
			}
		}
		cout << mm << endl;
	}
	return 0;
}